/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.itver.uml.dataobject;

import java.awt.Image;
import java.util.Properties;
import org.openide.util.Utilities;

/**
 *
 * @author Viruz
 */
public class ItverData {
    private Properties props;
    private Image icon16;
    private Image icon32;

    public static final String PROP_ID = "id";
    public static final String PROP_NAME = "nombre";
    public static final String PROP_COMMENT = "comentario";
    public static final String PROP_ICON16 = "icon16";
    public static final String PROP_ICON32 = "icon32";


    public ItverData( Properties props ) {
        this.props = props;
        loadIcons();
    }

    public String getId() {
        return props.getProperty( PROP_ID );
    }

    public String getDisplayName() {
        return props.getProperty( PROP_NAME );
    }

    public String getComentario() {
        return props.getProperty( PROP_COMMENT );
    }

    public Image getSmallImage() {
        return icon16;
    }

    public Image getBigImage() {
        return icon32;
    }

    @Override
    public boolean equals(Object obj) {
        if( obj instanceof ItverData ) {
            return getId().equals( ((ItverData)obj).getId() );
    }
        return false;
    }

    private void loadIcons() {
        String iconId = props.getProperty( PROP_ICON16 );
        icon16 = Utilities.loadImage( iconId );
        iconId = props.getProperty( PROP_ICON32 );
        icon32 = Utilities.loadImage( iconId );
    }
}
